package me.zhengjie.modules.quartz.task.pull;

import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.quartz.service.dto.SyncCommon;
import me.zhengjie.modules.sync.PullBase;

import java.util.Date;

@Slf4j
public abstract class PullOneTaskBase<T extends PullBase> extends PullTaskBase {
    private T pullService;

    public PullOneTaskBase(T pullService){
        this.pullService=pullService;
    }

    @Override
    protected void pull(SyncCommon syncCommon, Date date){
        log.info("run companyUuid {} pull start ",syncCommon.getCompanyUuid());
        Long startTime=System.currentTimeMillis();
        pullService.pull(syncCommon, date);
        Long endTime=System.currentTimeMillis();
        log.info("run companyUuid {} pull end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));
    };
}
